<template>
  <div>
    <van-nav-bar :border="false" fixed title="服务中心" left-arrow @click-left="GOback" placeholder />
    <section class="service_connect ">
      <a class="service_left service_conn" href="https://ecs-im.ele.me/">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-nvkefu"></use>
        </svg>
        <span>在线客服</span>
      </a>
      <a class="service_right service_conn" href="tel:10105757">
        <van-icon name="phone" color="#6ac20b" size="1rem" />
        <span>在线客服</span>
      </a>
    </section>
    <section class="hot_questions">
      <h4 class="qustion_header">热门问题</h4>
      <ul>
        <li class="question_title" v-for="(item,index) in freshmanData" :key="index" @click="specifyEvent(item.text,index)">
          <span>{{item.text}}</span>
          <van-icon name="arrow" color="#bbbbbb" size=".6rem" />
        </li>
      </ul>
    </section>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  computed: {
    ...mapState(['freshmanData'])
  },
  methods: {
    GOback() {
      this.$router.go(-1)
    },
    specifyEvent(text, index) {
      const obj = {
        text,
        index
      }
      console.log(index)
      this.$store.commit('questionDetailAdd', obj)
      this.$router.push('/service/questionDetail')
    }
  },
  mounted() {
    this.$store.dispatch('freshmanContent')
  }
}
</script>

<style lang="less" scoped>
.service_connect {
  display: flex;
  justify-content: space-between;
  .service_left {
    border-right: 1px solid #f1f1f1;
  }
  .service_conn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 4rem;
    border-bottom: 1px solid #f1f1f1;
    span {
      margin-top: 0.4rem;
      font-size: 0.58rem;
      color: #666;
    }
  }
}
.icon {
  width: 1rem;
  height: 1rem;
}
.qustion_header {
  font-size: 0.7rem;
  color: #333;
  line-height: 3rem;
  border-bottom: 1px solid #f1f1f1;
  padding-left: 0.7rem;
  font-weight: 400;
}
.question_title {
  padding: 0 0.7rem;
  line-height: 2rem;
  border-bottom: 1px solid #f1f1f1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  span {
    font-size: 0.58rem;
    color: #666;
  }
}
</style>